/* 
 * File:   MapSiteCatalog.cpp
 * Author: chb
 * 
 * Created on September 13, 2009, 11:52 AM
 */

#include "MapSiteCatalog.h"

#include "Wall.h"
#include "Tile.h"
#include "Door.h"

MapSiteCatalog* MapSiteCatalog::_instance = 0;

MapSiteCatalog::MapSiteCatalog() {
    _mapSites.push_back(new Wall);
    _mapSites.push_back(new Tile);
    _mapSites.push_back(new Door);
}

MapSiteCatalog::MapSiteCatalog(const MapSiteCatalog& orig) {
}

MapSiteCatalog* MapSiteCatalog::instance() {
    if(_instance == 0) {
        _instance = new MapSiteCatalog;
    }
    return _instance;
}

MapSiteCatalog::~MapSiteCatalog() {
}

MapSite* MapSiteCatalog::getNewMapSite(unsigned int x,unsigned int y, MapSite::MS_TYPE type) {
    for(std::vector<MapSite*>::const_iterator it = _mapSites.begin(); it != _mapSites.end(); ++it) {
        if((*it)->getType() == type) {
            return (*it)->clone(x, y);
        }
    }
    return 0;
}


